<?php
#date_default_timezone_set("Asia/Shanghai");

define('IN_HZHIU', true); //程序入口
if ( !defined( 'DIRECTORY_SEPARATOR' ) ) {
    define( 'DS',strtoupper(substr(PHP_OS, 0, 3) == 'WIN') ? '\\' : '/') ;
}else{
	define( 'DS',DIRECTORY_SEPARATOR);
}
define('TIME',              time());
define('MICROTIME',         microtime());
define("ROOT",				dirname(dirname(__FILE__)));
define("ROOT_WWW",			ROOT.DS.'www');
define("ROOT_APP",			ROOT.DS.'app');
define("ROOT_CONFIG",		ROOT.DS.'config');
define("ROOT_SLIGHTPHP",	ROOT.DS.'lib'.DS.'slightphp'.DS);
define("ROOT_PLIGUNS",		ROOT_SLIGHTPHP.'plugins');
define('ROOT_URL',          'http://'.$_SERVER['HTTP_HOST'].'/');
define('ROOT_PHP_SELF',     $_SERVER['PHP_SELF']);

require_once(ROOT_SLIGHTPHP.DS."SlightPHP.php");
require_once("com.fun.php");

function __autoload($class){
	if($class{0}=="S"){
		$file = ROOT_PLIGUNS.DS."$class.class.php";
	}else{
		$file = SlightPHP::$appDir.DS.str_replace("_",DS,$class).".class.php";
	}
	if(file_exists($file)){
		require_once($file);
	}else{
		$file=ROOT.DS.'helpers'.DS.str_replace("_",DS,$class).".php";
		if(file_exists($file))
		{
			require_once($file);
		}
	}
	
	if(!class_exists($class))
	{
		throw new Exception('Class '.$class.' not found');
	}
}
spl_autoload_register('__autoload');

